package com.example.stringbufferlogger.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.stringbufferlogger.VO.PageResponse;
import com.example.stringbufferlogger.entity.ReplayLog;
import com.example.stringbufferlogger.entity.ReplayResult;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;
@Mapper
public interface ReplayLogMapper extends BaseMapper<ReplayLog> {

    /**
     * 查询 compare_status 为 1，且 isupload 或者 isdownload 为 1 的 requestid 和 path
     * compare_status = 0标识未比对，=1表示已进行报文比对，=2表示在1的基础上进行了文件比对
     * @return 包含 requestid 和 path 的 Map 列表
     */
    @Select("SELECT requestid, path FROM replay_log WHERE compare_status = '1' AND (isupload = 1 OR isdownload = 1)")
    List<Map<String, Object>> selectRequestIdAndPathByStatus();
    /**
     * 根据 requestid、compare_status 和 replay_status 查询 path 列表
     * @param requestid 请求 ID
     * @return path 列表
     */
    @Select("SELECT path FROM replay_log WHERE requestid = #{requestid} AND compare_status = 0 AND replay_status = 1 AND (isupload = 1 OR isdownload = 1) AND ROWNUM = 1")
    String selectPathByRequestIdAndStatus(@Param("requestid") String requestid);

    List<ReplayLog> getReplayLogByRequestId();



}